package com.example.data.serviceImpl;

import com.example.data.dao.ProductDAO;
import com.example.data.entity.Product;
import com.example.data.service.ProductService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("ProductServiceImpl")
public class ProductServiceImpl implements ProductService {

    @Autowired
    ProductDAO productDAO;

    @Override
    public List<Product> queryDataAll() {
       List<Product> list = productDAO.queryDataAll();
       return list;
    }

    @Override
    public PageInfo<Product> queryData(Product product, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Product> data = productDAO.queryData(product);
        PageInfo<Product> dataList  =  new PageInfo<>(data);
        return dataList;
    }

}





